package com.x.erp.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.x.erp.thirdparty.ModelMappingQczj;
import com.x.framework.dao.BaseDao;

/**
 * 与汽车之家车型关系映射
 * @author gdf
 *
 */
@Repository
public class ModelMappingQczjDao extends BaseDao{
	
private final static String selectQczjModelListSql = "SELECT T1.* FROM ERP_MODEL_MAPPING_QCZJ T1 WHERE 1=1 ";
	
	public List<ModelMappingQczj> selectQczjModelList(ModelMappingQczj modelMappingQczj) throws Exception{
		StringBuilder sb = new StringBuilder(selectQczjModelListSql);
		List<Object> params = new ArrayList<Object>();
		if(this.isNotNull(modelMappingQczj.getModelId())){
			sb.append("AND T1.MODEL_ID = ? ");
			params.add(modelMappingQczj.getModelId());
		}
		if(this.isNotNull(modelMappingQczj.getMappingProductId())){
			sb.append("AND T1.MAPPING_PRODUCT_ID = ? ");
			params.add(modelMappingQczj.getMappingProductId());
		}
		if(this.isNotNull(modelMappingQczj.getMappingSeriesId())){
			sb.append("AND T1.MAPPING_SERIES_ID = ? ");
			params.add(modelMappingQczj.getMappingSeriesId());
		}
		if(this.isNotNull(modelMappingQczj.getMappingBrandId())){
			sb.append("AND T1.MAPPING_BRAND_ID = ? ");
			params.add(modelMappingQczj.getMappingBrandId());
		}
		return this.queryForList(sb.toString(), ModelMappingQczj.class, params);
	}

}
